/*
 * @Author: zhangweinan
 * @Date: 2022-11-16 09:45:46
 * @LastEditors: zhangweinan
 * @LastEditTime: 2023-05-29 15:31:36
 * @Description: file content
 * @FilePath: \contradiction-mediation-center\src\api\bpm\task.js
 */
import request from "@/utils/request";

export function getTodoTaskPage(query) {
  return request({
    url: "/bpm/task/todo-page",
    method: "get",
    params: query,
  });
}

export function getDoneTaskPage(query) {
  return request({
    url: "/bpm/task/done-page",
    method: "get",
    params: query,
  });
}

export function completeTask(data) {
  return request({
    url: "/bpm/task/complete",
    method: "PUT",
    data: data,
  });
}

export function approveTask(data) {
  return request({
    url: "/bpm/task/approve",
    method: "PUT",
    data: data,
  });
}

export function rejectTask(data) {
  return request({
    url: "/bpm/task/reject",
    method: "PUT",
    data: data,
  });
}
export function backTask(data) {
  return request({
    url: "/bpm/task/back",
    method: "PUT",
    data: data,
  });
}

export function updateTaskAssignee(data) {
  return request({
    url: "/bpm/task/update-assignee",
    method: "PUT",
    data: data,
  });
}
export function addSignTask(data) {
  return request({
    url: "/bpm/task/addSignTask",
    method: "POST",
    data: data,
  });
}

export function getTaskListByProcessInstanceId(processInstanceId) {
  return request({
    url:
      "/bpm/task/list-by-process-instance-id?processInstanceId=" +
      processInstanceId,
    method: "get",
  });
}

export function fallback(data) {
  return request({
    url: "/bpm/task/fallback",
    method: "POST",
    data: data,
  });
}

// 节点表单回显
export function getNodeFormJson(params) {
  return request({
    url: "/bpm/task/getTaskBpmForm",
    method: "POST",
    params,
  });
}

// 保存节点表单数据
export function saveNodeFormData(params, data) {
  return request({
    url: "/bpm/task/createTaskIdForFormKeyInfo",
    method: "POST",
    params,
    data
  });
}
//任务耗时-日走势
export function getHourDurationDateLine() {
  return request({
    url: "/bpm/task-statistics/getHourDurationDateLine",
    method: "get",
  });
}
//流程待办分类统计
export function getProcessModelDue() {
  return request({
    url: "/bpm/task-statistics/getProcessModelDue",
    method: "get",
  });
}
//获取流程实例节点-按钮配置
export function getTaskProcessConfig(taskId) {
  return request({
    url: `bpm/act-btn/getTaskProcessConfig/${taskId}`,
    method: "get",
  });
}
//获取已发布的流程
export function getDeployments() {
  return request({
    url: "bpm/process-definition/getDeployments",
    method: "get"
  });
}
//动态指定下一个节点
export function approveNext(data) {
  return request({
    url: "bpm/task/approve_next",
    method: "put",
    data
  });
}




